﻿@using Vit.Web;
@helper Render(IEnumerable<dynamic> items, Func<dynamic, object> itemTemplate, Func<dynamic, bool> isVisible = null, object paras = null, int repeatColumns = -1, Func<dynamic, object> repeatColumnStart = null, Func<dynamic, object> repeatColumnEnd = null)
    {
        int idx = 0;
        int total = items.Count();
        foreach (var item in items)
        {
            if (isVisible == null || isVisible(item))
            {
                if (repeatColumns > 0 && idx % repeatColumns == 0 && repeatColumnStart != null)
                {
    @repeatColumnStart(item)
                }
    @itemTemplate(item)
if (repeatColumns > 0 && (idx % repeatColumns == repeatColumns - 1 || idx == total - 1) && repeatColumnEnd != null)
{ 
    @repeatColumnEnd(item) 
}
idx++;
            }
        }
}
